Class ChameleonTile
- java.lang.Object
-
- page.codeberg.terratactician_expandoria.world.tiles.Tile
-
- page.codeberg.terratactician_expandoria.world.tiles.ChameleonTile
-
public class ChameleonTile extends Tile
A chameleon tile can be used in chameleon mode, for visual purposes.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class page.codeberg.terratactician_expandoria.world.tiles.Tile
Tile.TileType
-
-
Field Summary
Fields Modifier and Type Field Description java.lang.StringtextText displayed above this tile.Tile.TileTypetypeTile variant the chameleon tile is morphed into.-
Fields inherited from class page.codeberg.terratactician_expandoria.world.tiles.Tile
coord, reclaimTime
-
-
Constructor Summary
Constructors Constructor Description ChameleonTile()Creates a coordinate less chameleon tile.ChameleonTile(CubeCoordinate coord)Creates a chameleon tile with coordinates.ChameleonTile(CubeCoordinate coord, org.json.JSONObject data)Creates a chameleon tile with a coordinate and extra json meta data.ChameleonTile(ChameleonTile other)Create a copy/clone of a house.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Tileclone()Creates a clone of the tile.java.lang.StringdataToString()Can be used by tile to add internal data to `toString`.java.lang.StringgetName()Name of Tile in Api interface.org.json.JSONObjectserializeData()Serializes extra Data of an Tile, to be send.ChameleonTilewithData(Tile.TileType type, java.lang.String text)Short hand for.withType(type).withText(text)Will only be applied when placing the tile.ChameleonTilewithText(java.lang.String text)Set debug text displayed above..ChameleonTilewithType(Tile.TileType type)Set tile type.-
Methods inherited from class page.codeberg.terratactician_expandoria.world.tiles.Tile
deserialize, deserialize, getCoordinate, getTileType, reclaimable, serialize, takeable, toString
-
-
-
-
Field Detail
-
type
public Tile.TileType type
Tile variant the chameleon tile is morphed into.
-
text
public java.lang.String text
Text displayed above this tile.
-
-
Constructor Detail
-
ChameleonTile
public ChameleonTile()
Creates a coordinate less chameleon tile.
-
ChameleonTile
public ChameleonTile(CubeCoordinate coord)
Creates a chameleon tile with coordinates.- Parameters:
coord- coordinate of the chameleon tile
-
ChameleonTile
public ChameleonTile(ChameleonTile other)
Create a copy/clone of a house.- Parameters:
other- tile to clone
-
ChameleonTile
public ChameleonTile(CubeCoordinate coord, org.json.JSONObject data)
Creates a chameleon tile with a coordinate and extra json meta data.- Parameters:
coord- coordinate of the tiledata- extra data
-
-
Method Detail
-
getName
public java.lang.String getName()
Description copied from class:TileName of Tile in Api interface.
-
serializeData
public org.json.JSONObject serializeData()
Description copied from class:TileSerializes extra Data of an Tile, to be send.- Overrides:
serializeDatain classTile- Returns:
- null or JSONObject with at least a valid "type" field.
-
withText
public ChameleonTile withText(java.lang.String text)
Set debug text displayed above.. Is only effective when this instance is send to the game. e.g. via a place action. To change a tile, useConfigureChameleonTileActioninstead.- Parameters:
text- displayed text- Returns:
- reference to this
-
withType
public ChameleonTile withType(Tile.TileType type) throws java.lang.IllegalArgumentException
Set tile type. Is only effective when this instance is send to the game. e.g. via a place action. To change a tile, useConfigureChameleonTileActioninstead.- Parameters:
type- Tile variant the chameleon tile should morph into.- Returns:
- reference to this
- Throws:
java.lang.IllegalArgumentException- gets thrown if this is not a valid tile type.
-
withData
public ChameleonTile withData(Tile.TileType type, java.lang.String text)
Short hand for.withType(type).withText(text)Will only be applied when placing the tile. UseConfigureChameleonTileActionto change an existing tile.- Parameters:
type- Tile variant the chameleon tile should morph into.text- displayed text- Returns:
- reference to this
-
dataToString
public java.lang.String dataToString()
Description copied from class:TileCan be used by tile to add internal data to `toString`. Returned string should start with: ", "- Overrides:
dataToStringin classTile- Returns:
- additional data stringified
-
-